{% extends "library/base/base_site.html" %}
{% load static %}
{% load bootstrap %}
{% load custom_filters %}
{% block title %} {{ title|default:"" }} {% endblock title %}
{% block stylesheets %}
    {{ block.super }}
    <link href="{% static 'library/css/plugins/jquery-labelauty.css' %}" rel="stylesheet">
{% endblock stylesheets %}
{% block content %}
<div class="x_title">
    <h2>
        {% if form.instance and form.instance.id|slugify in request.path %}{{ title|default:"" }}修改
        {% elif "/add/" in request.path or "/add" in request.path %}{{ title|default:"" }}添加
        {% else %}{{ title|default:"" }}
        {% endif %}
    </h2>
    <ul class="nav navbar-right panel_toolbox">
        <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
        </li>
        {% block operates %}
        {% if operates and operates|length > 0 %}
        <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
            <ul class="dropdown-menu" role="menu">
            {% for operate in operates %}
                    <li>
                        {{ operate|gen_operate_item:request }}
                    </li>
            {% endfor %}
            </ul>
        </li>
        {% endif %}
        {% endblock operates %}
        <li>
            <a class="close-link"><i class="fa fa-close"></i></a>
        </li>
    </ul>
    <div class="clearfix"></div>
</div>
<div class="x_content">
    <form class="form-horizontal form-label-left" enctype="multipart/form-data" method="post">
        {% csrf_token %}
        {{ form|bootstrap_horizontal }}
        <input type="hidden" name="back_step" value={{back_step}}>
        <div class="ln_solid"></div>
        <div class="form-group">
            <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                <a class="btn btn-primary"
                {% if form.instance and form.instance.id|slugify in request.path %}
                href="./"
                {% elif "/add/" in request.path %}
                href="../list"
                {% elif "/add" in request.path %}
                href="list"
                {% else %}
                href="javascript:history.back();"
                {% endif %}
                >取消</a>
                <button class="btn btn-primary" type="reset">重置</button>
                <button type="submit" class="btn btn-success">提交</button>
            </div>
      </div>
    </form>
</div>
{% endblock content %}

{% block javascripts %}
    {{ block.super }}
    <script src="{% static 'library/js/plugins/jquery-labelauty.js' %}"></script>
    <script src="{% static 'library/js/plugins/modal/modal-form-widget.js' %}"></script>
{% endblock javascripts %}